// 打包后，将index.html中header内的js改为异步加载
import { IApi } from 'umi';
export default (api: IApi) => {
  api.modifyHTML(($) => {
    $('script').attr('src', (index, src) => {
      if (src.includes('umi')) {
        $('script').eq(0).attr('defer', 'true');
      }
      return src;
    });
    return $;
  });
};
